package com.zlyx.easy.socket.annotations;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.springframework.stereotype.Component;

import com.zlyx.easy.core.annotations.Desc;

@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
@Inherited
@Desc("消息处理器")
public @interface MsgHandler {

	@Desc("描述")
	String[] todo();

	@Desc("开启状态(默认开启)")
	boolean isOpen() default true;

	@Desc("消息服务类型")
	MsgType type();

	@Desc("缓冲区大小(可根据接收数据长度动态配置,默认为1024*1")
	float size() default 1;

	@Desc("不允许出现端口一样的情况")
	int port();

	public enum MsgType {
		/**
		 * AIO_TCP
		 */
		ATM,
		/**
		 * BIO_TCP
		 */
		BTM,
		/**
		 * BIO_UDP
		 */
		BUM,
		/**
		 * NIO_TCP
		 */
		NTM,
		/**
		 * NIO_UDP
		 */
		NUM;
	}
}